package lab03.test14;

import java.sql.*;

public class Tset {
    public static void main(String[] args) throws ClassNotFoundException {
        //3+1
        Connection connection=null;
        Statement statement=null;
        ResultSet resultSet=null;
        String sql="select * from t_userinfo";
        try{
            Class.forName("com.mysql.jd" +
                    "bc.Driver");
            connection = DriverManager.getConnection(
                    "jdc:mysql://localhost:3306/java_2017",
                            "root" ,
                    "123456"
            );
            statement = connection.createStatement();
            resultSet=statement.executeQuery(sql);
            while (resultSet.next()){
                System.out.println(resultSet.getString(1));
                System.out.println(resultSet.getString(2));
                System.out.println(resultSet.getString(3));
                System.out.println(resultSet.getString(4));
            }
        }catch (ClassNotFoundException e){
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
